package cn.com.qtgl.sso.oidc.comp.service;

import cn.com.qtgl.sso.oidc.model.vo.SsoToken;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.support.ApplicationObjectSupport;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
//@CacheConfig(cacheNames = {"token"})
public class TokenCache {

    @Resource
    @Lazy
    private TokenService tokenService;

//    @Cacheable(key = "'systemToken'")
    public SsoToken getSystemToken(){
        return tokenService.getSystemToken();
    }

//    @Cacheable(cacheNames = {"SystemTokenValue"},key="'systemToken'")
    public String getSystemTokenValue(){
        return tokenService.getSystemToken().getAccessToken();
    }


}
